/**
 * 新闻、公告
 * Created by KY on 2017/11/9.
 */
define(['ldfw/core','text!tpl/news/detail.tpl','comps/ajax','ldfw/utils/format'],function(LDFW,tpl,ajax){
    const Article = LDFW.SpiderData.extend({
        defaults: {
            'article_author': current_company,
            'article_date': new Date().format('yyyy-MM-dd'),
            'article_title': '',
            'article_content':''
        }
    })
    const View = LDFW.Container.extend({
        tpl:tpl,
        model:new Article(),
        className:'panel detail-panel',
        initialize: function () {
        },
        setArticleNo(articleNo){
            this.articleNo = articleNo
        },
        loadData(){
            const _this = this
            ajax.post('pfL.13.10',{
                article_no:this.articleNo
            }).success(function(resp){
                let article = resp.result[0],
                    article_content = ''
                if(article){
                    article_content = _.unescape(article.official_art_content)
                    _this.model.set('article_content',article_content)
                    _this.model.set('article_date', format('date','yyyy-MM-dd',article.publish_date))
                    _this.model.set('article_title',article.official_art_title)
                    _this.model.set('article_type','公告内容')
                }
            })
        }
    })
    return new View()
})